package com.heima.user.contorller;

import com.heima.common.dtos.ResponseResult;
import com.heima.model.user.dtos.LoginDto;
import com.heima.user.service.ApUserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/api/v1/login")
public class ApUserLoginController {
    @Resource
    private ApUserService apUserService;


    @ApiOperation(value = "手机号密码登录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dto", value = "登录", required = true)
    })
    @PostMapping("/login_auth")
    public ResponseResult<Map<String, Object>> login(@RequestBody LoginDto dto) {
        ResponseResult<Map<String, Object>> responseResult = this.apUserService.login(dto);
        return responseResult;
    }
}
